package com.restaurant.application.accumulategoods.support;

import com.nebutown.base.ViewSpec;
import com.nebutown.base.data.ViewUpdate;
import com.nebutown.description.data.UnitForGeneration;
import com.nebutown.generation.PickableBean;
import com.nebutown.supporthome.AbstractBase;
import com.nebutown.supporthome.CmdCapsule;
import com.restaurant.application.accumulategoods.AccumulateGoodsImpl;
import com.restaurant.application.indexes.accumulategoodslist.mysql.AccumulateGoodsListBean;

public class AccumulateGoodsBase extends AbstractBase {
    private UnitForGeneration desc = new UnitForGeneration();
    
    public AbstractAccumulateGoods getImpl() {
        AbstractAccumulateGoods inst = new AccumulateGoodsImpl();
        inst.setBase(this, getEscort());
        return inst;
    }
    
    @Override
    public AccumulateGoodsOutFace getUnitFace() {
        return new AccumulateGoodsOutFace(this);
    }
    
    @Override
    protected Object callDistr(String name, Object... param) {
        switch(name) {
            case "exchangeGoods":
                getImpl().exchangeGoods();
                return "";
            case "getGoodsData": return getImpl().getGoodsData();
            case "getId": return getImpl().getId();
            case "getViewLead":
                return getImpl().getViewLead((ViewSpec) param[0]);
            case "getFullView": setIsRefresher(); return getImpl().getFullView();
            case "getEffectiveInterface": return getImpl().getEffectiveInterface();
            case "timerCall":
                return getImpl().timerCall((String) param[0]);
            case "getGoodsUIDDataForAccumulateGoodsList":
                return getImpl().getGoodsUIDDataForAccumulateGoodsList((AccumulateGoodsListBean) param[0]);
        }
        return null;
    }
    
    @Override
    protected boolean authDistr(String name) {
        switch(name) {
        }
        return true;
    }
    
    @Override
    public CmdCapsule getUICall(int cmd) {
        switch(cmd) {
            case 0: return AbstractAccumulateGoods.CMD_SAVE;
            case 1: return AbstractAccumulateGoods.CMD_CANCEL;
        }
        return null;
    }
    
    @Override
    public ViewUpdate uiCall(int cmd, PickableBean param, int... seq) {
        switch(cmd) {
            case 0: return getImpl().save((GoodsData)param, seq);
            case 1: return getImpl().cancel(seq);
        }
        return null;
    }
}
